import request from '@/utils/request'

//1. 查询所有员工
export function findEmps(data) {
  return request({
    url: '/emp?cmd=list',
    method: 'post',
    data
  })
}
//2. 分页查询员工
export function findByPage(page,pagesize,data) {
  return request({
    url: `/emp?cmd=findByPage&page=${page}&pagesize=${pagesize}`,
    method: 'post',
    data
  })
}

//3. 分页带条件查询员工
export function search(page,pagesize,empSearch,data) {
  let empSear = JSON.stringify(empSearch)
  return request({
    url: `/emp?cmd=search&page=${page}&pagesize=${pagesize}&empSearch=${empSear}`,
    method: 'post',
    data
  })
}

//添加
export function add(emp){
 emp = JSON.stringify(emp)
  return request({
    url: `/emp?cmd=add&emp=${emp}`,
    method:'post',
  })
}
//修改
export function update(emp){
  emp = JSON.stringify(emp)
  return request({
    url: `/emp?cmd=update&emp=${emp}`,
    method:'post',
  })
}
//删除
export function delet(eids){
  return request({
    url:`emp?cmd=delete&eids=${eids}`,
    method:'get',
  })
}
